// import store from  '../store/cart.js'

// console.log(store.getters.total,6677788)

import  {mapGetters}  from  'vuex'

export default {
  data(){
    return  {}
  },
  watch:{
    total(newVal){
      console.log(newVal,777777)
      this.setTabBarBarage()  //购物车数量更改的时候
    }
  },
  computed:{
    ...mapGetters("cart",['total'])
  },
  onShow(){
    this.setTabBarBarage()  //初次进入购物车页面就显示数量
  },
  methods:{
    setTabBarBarage(){
      uni.setTabBarBadge({
        index: 2,
        text: this.total+''
      })
    }
  }
}